import 'dart:convert';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
import 'package:sticky_headers/sticky_headers/widget.dart';

import '../../config/Config.dart';

class DescriptionGeneratorPage extends StatefulWidget {
  const DescriptionGeneratorPage({super.key});

  @override
  State<DescriptionGeneratorPage> createState() =>
      _DescriptionGeneratorPageState();
}

class _DescriptionGeneratorPageState extends State<DescriptionGeneratorPage> {
  final List<dynamic> list = getData();
  final ItemScrollController itemScrollController = ItemScrollController();
  final ItemPositionsListener itemPositionsListener = ItemPositionsListener.create();

  late int currentIndex = 0;

  @override
  void initState() {
    super.initState();

    itemPositionsListener.itemPositions.addListener(() {
      final positions = itemPositionsListener.itemPositions.value;
      if (positions.isNotEmpty) {
        setState(() {
          currentIndex = positions
              .where((ItemPosition position) => position.itemLeadingEdge >= 0)
              .map((ItemPosition position) => position.index)
              .reduce((min, current) => current < min ? current : min);
        });
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Config.colorF8,
      appBar: AppBar(
        backgroundColor: Colors.white,
        title: const Text("描述生成器"),
        leading: BackButton(
          onPressed: () {
            Navigator.of(context).pop();
          },
        ),
      ),
      body: Row(
        children: [
          SizedBox(
            width: 100,
            child: ListView(
              children: List.generate(list.length, (index) {
                return ListTile(
                  onTap: (){
                    itemScrollController.scrollTo(
                      index: index,
                      duration: const Duration(milliseconds: 500),
                    );
                  },
                  title: Text(
                    "${list[index]['categoryName']}",
                    style: TextStyle(
                      fontSize: 14,
                      fontWeight: currentIndex==index?FontWeight.bold:FontWeight.normal,
                    ),
                  ),
                );
              }),
            ),
          ),
          const SizedBox(
            width: 8,
          ),
          Expanded(
            child: ScrollablePositionedList.builder(
              itemCount: list.length,
              itemScrollController: itemScrollController,
              itemPositionsListener: itemPositionsListener,
              itemBuilder: (BuildContext context, int index) {
                return StickyHeader(
                  header: Container(
                    height: 48.0,
                    color: Colors.white,
                    padding: const EdgeInsets.symmetric(horizontal: 16.0),
                    alignment: Alignment.centerLeft,
                    child: Text(
                      "${list[index]['categoryName']}",
                      style: const TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ),
                  content: GridView.builder(
                    gridDelegate:
                    const SliverGridDelegateWithFixedCrossAxisCount(
                      crossAxisCount: 4,
                    ),
                    itemCount: list[index]['dataList'].length,
                    shrinkWrap: true,
                    physics: const NeverScrollableScrollPhysics(),
                    itemBuilder: (context, index1) {
                      var data = list[index]['dataList'][index1];
                      return Card(
                        shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(4.0),
                          side: BorderSide(
                            color: Colors.red,
                            width: index == 2 ? 2.0 : 0,
                          ),
                        ),
                        clipBehavior: Clip.hardEdge,
                        child: Stack(
                          children: [
                            CachedNetworkImage(
                              imageUrl: data['pic'],
                              fit: BoxFit.cover,
                            ),
                            Positioned(
                              left: 0,
                              right: 0,
                              bottom: 0,
                              child: Container(
                                padding:
                                const EdgeInsets.symmetric(vertical: 4),
                                color: Colors.black.withOpacity(0.6),
                                child: Text(
                                  data['name'],
                                  textAlign: TextAlign.center,
                                  style: const TextStyle(
                                    color: Colors.white,
                                    fontSize: 12,
                                  ),
                                ),
                              ),
                            )
                          ],
                        ),
                      );
                    },
                  ),
                );
              },
            ),
          ),
        ],
      ),
    );
  }

  static List<dynamic> getData() {
    String jsonString = '''
   [
            {
                "id": 100,
                "categoryCode": "incantation_style",
                "categoryName": "风格",
                "type": "text_to_image",
                "orderNumber": 100,
                "dataList": [
                    {
                        "code": "<impressionism>",
                        "name": "印象派",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01RCQAWj1toh5zF9gWp_!!6000000005949-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 0
                    },
                    {
                        "code": "<pointillism>",
                        "name": "点彩画",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01PNqZqj26LSp83XWGU_!!6000000007645-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 5
                    },
                    {
                        "code": "<impasto>",
                        "name": "厚涂",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01JyXQji1nb3bnokmR5_!!6000000005107-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 10
                    },
                    {
                        "code": "<pixel art>",
                        "name": "像素画",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01IQW0YG1mH4iAm0nA2_!!6000000004928-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 15
                    },
                    {
                        "code": "<pop art>",
                        "name": "波普艺术",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01W3Ejmp1TgHob9fI7P_!!6000000002411-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 20
                    },
                    {
                        "code": "<Colored pencil>",
                        "name": "彩铅",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01dFQc9f1qRqUNIwme9_!!6000000005493-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 25
                    },
                    {
                        "code": "<cyberpunk>",
                        "name": "赛博朋克",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01U1Zz891NVOhhW99yn_!!6000000001575-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 30
                    },
                    {
                        "code": "<Ukiyo-e>",
                        "name": "浮世绘",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01Wgl8JM1gY7lEt00Jj_!!6000000004153-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 35
                    },
                    {
                        "code": "<Pixar style>",
                        "name": "皮克斯风格",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01qDcQVU26GsrTbGx1F_!!6000000007635-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 40
                    },
                    {
                        "code": "<Low-Poly>",
                        "name": "低聚",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN012I0Hyg1orNKrHkdy4_!!6000000005278-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 45
                    },
                    {
                        "code": "<meticulous painting>",
                        "name": "工笔画",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01bfCeik1Nk3NXhBZRo_!!6000000001607-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 50
                    },
                    {
                        "code": "<ink painting>",
                        "name": "水墨画",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01N4BDW01oHeRQTa4Hh_!!6000000005200-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 55
                    },
                    {
                        "code": "<van gogh style>",
                        "name": "梵高风格",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01yZuOp6211FGBAkn0d_!!6000000006924-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 60
                    },
                    {
                        "code": "<Monet style>",
                        "name": "莫奈风格",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01sHXTXg1ZIpDcoXZ6N_!!6000000003172-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 65
                    },
                    {
                        "code": "<Steampunk>",
                        "name": "蒸汽朋克",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01Wd60KI21EWkMICAbQ_!!6000000006953-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 70
                    },
                    {
                        "code": "<dieselpunk>",
                        "name": "柴油朋克",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01lL6W0V1S1h64Gd9Di_!!6000000002187-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 75
                    },
                    {
                        "code": "<glitch art>",
                        "name": "故障艺术",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01TtTxmG1pWaywH3GcD_!!6000000005368-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 80
                    },
                    {
                        "code": "<Holographic projection>",
                        "name": "全息投影",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01NDgShr1UHqICGD5Mz_!!6000000002493-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 85
                    },
                    {
                        "code": "<mechanical aesthetics>",
                        "name": "机械美学",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01mVSj6g1hM2vx5wRfS_!!6000000004262-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 90
                    },
                    {
                        "code": "<antiquity>",
                        "name": "古风",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN013RvaTY29Tekt9yDW9_!!6000000008069-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 95
                    },
                    {
                        "code": "<Studio Ghibli>",
                        "name": "吉卜力",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01bN2VoB1N4pjVoKLwm_!!6000000001517-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 100
                    },
                    {
                        "code": "<afrofuturism>",
                        "name": "非洲未来主义",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01T4ZB7G23hV22GU5gx_!!6000000007287-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 105
                    },
                    {
                        "code": "<silhouette>",
                        "name": "剪影",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01x9xRls1ijgzpTbZKD_!!6000000004449-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 110
                    },
                    {
                        "code": "<doodle>",
                        "name": "涂鸦",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01rgg2ED21RoEQpZiDz_!!6000000006982-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 115
                    },
                    {
                        "code": "<shattering effect>",
                        "name": "碎裂效果",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01KRXvMa1G5Z3SiIC5f_!!6000000000571-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 120
                    },
                    {
                        "code": "<Bohemian style>",
                        "name": "波西米亚风格",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01My7y491ZStw3U62kC_!!6000000003194-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 125
                    },
                    {
                        "code": "<American comics>",
                        "name": "美式漫画",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01NLrZe31gteNTWwLN7_!!6000000004200-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 130
                    },
                    {
                        "code": "<ASCII art>",
                        "name": "ASCII art",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01pzjjxE29GNGkKfNSV_!!6000000008040-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 135
                    },
                    {
                        "code": "<Mondrian>",
                        "name": "蒙德里安",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01CP6qN71NAmsl9yG5I_!!6000000001530-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 140
                    },
                    {
                        "code": "<Picasso>",
                        "name": "毕加索",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01mKDL791Oy57ovgF2b_!!6000000001773-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 145
                    },
                    {
                        "code": "<Mucha>",
                        "name": "穆夏",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01uks8wg1aE4jHduedN_!!6000000003297-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 150
                    },
                    {
                        "code": "<Bauhaus>",
                        "name": "包豪斯",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN0173cYUh1UK8Gydq1Cn_!!6000000002498-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 155
                    },
                    {
                        "code": "<Q version>",
                        "name": "Q版",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01A6yinc1DbfybSgGoy_!!6000000000235-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 160
                    },
                    {
                        "code": "<watercolor>",
                        "name": "水彩",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01C9pAR31YKpKqxhSyi_!!6000000003041-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 165
                    },
                    {
                        "code": "<oil painting>",
                        "name": "油画",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01v66vF01ujUCtsPhir_!!6000000006073-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 170
                    },
                    {
                        "code": "<chinese painting>",
                        "name": "中国画",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01pnV9qb1VESzONE8uj_!!6000000002621-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 175
                    },
                    {
                        "code": "<flat illustration>",
                        "name": "扁平插画",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN011P24OV233eZiszKDO_!!6000000007200-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 180
                    },
                    {
                        "code": "<anime>",
                        "name": "二次元",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01SIYZYD20b8gVumoLy_!!6000000006867-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 185
                    },
                    {
                        "code": "<sketch>",
                        "name": "素描",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01HMTZaf1llTNns4buM_!!6000000004859-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 190
                    },
                    {
                        "code": "<3d cartoon>",
                        "name": "3D卡通",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01uZZalG1wRHhMaLe4g_!!6000000006304-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 100,
                        "orderNumber": 195
                    }
                ]
            },
            {
                "id": 200,
                "categoryCode": "incantation_light",
                "categoryName": "光线",
                "type": "text_to_image",
                "orderNumber": 200,
                "dataList": [
                    {
                        "code": "<rim light>",
                        "name": "轮廓光",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01hQxdhi1QKoOkXADpv_!!6000000001958-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 0
                    },
                    {
                        "code": "<Volumetric light>",
                        "name": "体积光",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01n1EJYr1q9z2je5AiA_!!6000000005454-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 5
                    },
                    {
                        "code": "<neon lights>",
                        "name": "霓虹灯",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01gmxkGk1Ty9GFG3Jnb_!!6000000002450-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 10
                    },
                    {
                        "code": "<laser light>",
                        "name": "镭射光",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01GnVREC1lCfHcg7wfc_!!6000000004783-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 15
                    },
                    {
                        "code": "<fluorescence>",
                        "name": "荧光",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01mIiYz424xolZ8okVL_!!6000000007458-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 20
                    },
                    {
                        "code": "<side light>",
                        "name": "侧光",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01TCP78k1I8Qlp3KPv4_!!6000000000848-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 25
                    },
                    {
                        "code": "<reflection light>",
                        "name": "反射光",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01hMWqf61XpE11aiAzH_!!6000000002972-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 30
                    },
                    {
                        "code": "<studio lighting>",
                        "name": "摄影棚照明",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01sLZ4M31UJfsNfaqgL_!!6000000002497-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 35
                    },
                    {
                        "code": "<lens flare>",
                        "name": "透镜光晕",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01XaCOve1LvqLGNyfq6_!!6000000001362-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 40
                    },
                    {
                        "code": "<Ambient lighting>",
                        "name": "氛围光照",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01qSWoFB1VEvNvDEStM_!!6000000002622-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 45
                    },
                    {
                        "code": "<Natural light>",
                        "name": "自然光",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN012fYAtI27WHnWEsj36_!!6000000007804-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 50
                    },
                    {
                        "code": "<space light>",
                        "name": "太空光",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01eNMmEU20kIbdZ8uUX_!!6000000006887-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 55
                    },
                    {
                        "code": "<background light>",
                        "name": "背景光",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN0143EHdW1aP4Ea1xAsY_!!6000000003321-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 60
                    },
                    {
                        "code": "<Backlight>",
                        "name": "逆光",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01VKcpef1XlYq7ID8nW_!!6000000002964-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 65
                    },
                    {
                        "code": "<spot light>",
                        "name": "聚光灯",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01d81JgP1OL9SYppwKq_!!6000000001688-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 70
                    },
                    {
                        "code": "<glow effect>",
                        "name": "发光效果",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01pSFgre1x4flEyO72K_!!6000000006390-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 75
                    },
                    {
                        "code": "<cold light>",
                        "name": "冷光",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01PSMEjF1N0FltWkIas_!!6000000001507-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 80
                    },
                    {
                        "code": "<warm light>",
                        "name": "暖光",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01g2rSSo1PYGPi6PLSL_!!6000000001852-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 85
                    },
                    {
                        "code": "<bioluminescent>",
                        "name": "生物发光",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01h11R062AAhz7UK5yx_!!6000000008163-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 90
                    },
                    {
                        "code": "<bisexual lighting>",
                        "name": "双性照明",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01LMsh7Y1OfIsyseolC_!!6000000001732-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 95
                    },
                    {
                        "code": "<Cinematic lighting>",
                        "name": "电影级光照",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01bVq0x51SVSqF4Lqxk_!!6000000002252-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 100
                    },
                    {
                        "code": "<Rembrandt light>",
                        "name": "伦勃朗光",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01Ox6KWH1d1eq6ukj0p_!!6000000003676-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 105
                    },
                    {
                        "code": "<Tyndall effect>",
                        "name": "丁达尔效应",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01cmDjzy29Ja2gBjmMk_!!6000000008047-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 110
                    },
                    {
                        "code": "<light leakage effect>",
                        "name": "漏光光效",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01e8pLnn1JSPf2aY5Pl_!!6000000001027-2-tps-144-144.png",
                        "styleType": "text_to_image",
                        "categoryId": 200,
                        "orderNumber": 115
                    }
                ]
            },
            {
                "id": 300,
                "categoryCode": "incantation_material",
                "categoryName": "材质",
                "type": "text_to_image",
                "orderNumber": 300,
                "dataList": [
                    {
                        "code": "<stained glass craft>",
                        "name": "彩色玻璃工艺",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01IHwhRn1Dtzon0xSJ5_!!6000000000275-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 0
                    },
                    {
                        "code": "<iridescent foil>",
                        "name": "彩虹箔",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01OoNSpp1lSh91McRp4_!!6000000004818-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 20
                    },
                    {
                        "code": "<x-ray>",
                        "name": "X光",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01N564uY1nLwXPPIdzv_!!6000000005074-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 30
                    },
                    {
                        "code": "<frosted glass>",
                        "name": "磨砂玻璃",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01kSU9Vk1JwBPBgAlNC_!!6000000001092-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 40
                    },
                    {
                        "code": "<glass gradient>",
                        "name": "玻璃渐变",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01Z3uZ6D1LYU8t0HsPx_!!6000000001311-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 50
                    },
                    {
                        "code": "<copper plate engraving>",
                        "name": "铜板雕刻",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01jpgwAP1HWsHtPT3r9_!!6000000000766-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 60
                    },
                    {
                        "code": "<liquid metal>",
                        "name": "液态金属",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01LwkS3x1LX6xGATi0I_!!6000000001308-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 70
                    },
                    {
                        "code": "<felt style>",
                        "name": "毛毡风格",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01Dtf7QK26cPTbNrr8p_!!6000000007682-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 80
                    },
                    {
                        "code": "<inflatable>",
                        "name": "充气效果",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01dbp9dh1YrnqwJC2mq_!!6000000003113-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 90
                    },
                    {
                        "code": "<aluminum>",
                        "name": "铝制",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01NYejcQ1zT45OPKuHw_!!6000000006714-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 100
                    },
                    {
                        "code": "<acrylic texture>",
                        "name": "亚克力质感",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01zZ4Mrt1xusubH4TGq_!!6000000006504-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 110
                    },
                    {
                        "code": "<paper quilling art>",
                        "name": "衍纸艺术",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01IEqcrP1K9vHrAUugw_!!6000000001122-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 300,
                        "orderNumber": 120
                    }
                ]
            },
            {
                "id": 400,
                "categoryCode": "incantation_render",
                "categoryName": "渲染",
                "type": "text_to_image",
                "orderNumber": 400,
                "dataList": [
                    {
                        "code": "<Unreal Engine>",
                        "name": "虚幻引擎",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01pRyrKP1dzeitLth3g_!!6000000003807-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 400,
                        "orderNumber": 0
                    },
                    {
                        "code": "<C4D>",
                        "name": "C4D",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01rQ8LA8245JcwUdQfl_!!6000000007339-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 400,
                        "orderNumber": 10
                    },
                    {
                        "code": "<Blender>",
                        "name": "Blender",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01FC0ceA1lxNgKJD9vz_!!6000000004885-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 400,
                        "orderNumber": 20
                    },
                    {
                        "code": "<Octane>",
                        "name": "Octane",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01voz3H21zidYIfygiP_!!6000000006748-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 400,
                        "orderNumber": 30
                    }
                ]
            },
            {
                "id": 500,
                "categoryCode": "incantation_color",
                "categoryName": "色彩",
                "type": "text_to_image",
                "orderNumber": 500,
                "dataList": [
                    {
                        "code": "<pastel colors>",
                        "name": "柔和色彩",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01vgXz731Jvj0d7GmXa_!!6000000001091-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 500,
                        "orderNumber": 0
                    },
                    {
                        "code": "<Morandi shades>",
                        "name": "莫兰迪色调",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01ElUMbo1aGp6fu4vkT_!!6000000003303-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 500,
                        "orderNumber": 5
                    },
                    {
                        "code": "<Fluorescent color>",
                        "name": "荧光色",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01glGb8y1oUvvdMaN37_!!6000000005229-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 500,
                        "orderNumber": 10
                    },
                    {
                        "code": "<complementary colors>",
                        "name": "互补色",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01hZFdo91t296uvQpqd_!!6000000005843-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 500,
                        "orderNumber": 15
                    }
                ]
            },
            {
                "id": 550,
                "categoryCode": "incantation_composition",
                "categoryName": "构图",
                "type": "text_to_image",
                "orderNumber": 600,
                "dataList": [
                    {
                        "code": "<Isometric view>",
                        "name": "等距视图",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01oJeRki1ozA4HsRRzx_!!6000000005295-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 550,
                        "orderNumber": 0
                    },
                    {
                        "code": "<Symmetric structure>",
                        "name": "对称结构",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01E9Yer91TC3fxP6Rfr_!!6000000002345-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 550,
                        "orderNumber": 5
                    },
                    {
                        "code": "<Knolling>",
                        "name": "Knolling",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01hkOdUX1R1rd0Jomae_!!6000000002052-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 550,
                        "orderNumber": 10
                    },
                    {
                        "code": "<3D floor plan>",
                        "name": "3D平面图",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01vOR9Jd1MyQBdfdsWq_!!6000000001503-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 550,
                        "orderNumber": 15
                    }
                ]
            },
            {
                "id": 600,
                "categoryCode": "incantation_view",
                "categoryName": "视角",
                "type": "text_to_image",
                "orderNumber": 700,
                "dataList": [
                    {
                        "code": "<macro lens>",
                        "name": "微距镜头",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01n8melT1blnVSGL9OB_!!6000000003506-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 600,
                        "orderNumber": 0
                    },
                    {
                        "code": "<ultra wide angle lens>",
                        "name": "超广角镜头",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01IX3WXV1VOXhfX7tNG_!!6000000002643-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 600,
                        "orderNumber": 5
                    },
                    {
                        "code": "<telephoto lens>",
                        "name": "长焦镜头",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01ff19xy27T51hCqtr8_!!6000000007797-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 600,
                        "orderNumber": 10
                    },
                    {
                        "code": "<fisheye>",
                        "name": "鱼眼镜头",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01B7Z0hK1fAThEVdFOm_!!6000000003966-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 600,
                        "orderNumber": 15
                    },
                    {
                        "code": "<Looking up>",
                        "name": "仰视视角",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01gwcJHl26P7zYHbWtS_!!6000000007653-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 600,
                        "orderNumber": 20
                    },
                    {
                        "code": "<top view>",
                        "name": "俯视视角",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01Ft0os31bevZCWnyp2_!!6000000003491-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 600,
                        "orderNumber": 25
                    }
                ]
            },
            {
                "id": 700,
                "categoryCode": "incantation_common",
                "categoryName": "常用咒语",
                "type": "text_to_image",
                "orderNumber": 800,
                "dataList": [
                    {
                        "code": "wanxlite1.4.5_textlora_shuimo2_20240529",
                        "name": "水墨人像",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN012eImHm1Hime6lmcbO_!!6000000000792-0-tps-500-500.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 0,
                        "extInfo": ""
                    },
                    {
                        "code": "<Q version>",
                        "name": "Q版",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01MFW8PJ1Rs4mOiM6P2_!!6000000002166-0-tps-132-132.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 1
                    },
                    {
                        "code": "<watercolor>",
                        "name": "水彩",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN0127BIxo1eyZOm7UD6Y_!!6000000003940-0-tps-132-132.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 5
                    },
                    {
                        "code": "<oil painting>",
                        "name": "油画",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01v66vF01ujUCtsPhir_!!6000000006073-0-tps-144-144.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 10
                    },
                    {
                        "code": "<chinese painting>",
                        "name": "中国画",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01vWhH8025xeEFaxj0Y_!!6000000007593-0-tps-132-132.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 15
                    },
                    {
                        "code": "<flat illustration>",
                        "name": "扁平插画",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01Okgf0J1XV4a69QIil_!!6000000002928-0-tps-132-132.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 20
                    },
                    {
                        "code": "<anime>",
                        "name": "二次元",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01Ke9OZX1jYWxbMtjgB_!!6000000004560-0-tps-132-132.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 25
                    },
                    {
                        "code": "<sketch>",
                        "name": "素描",
                        "pic": "https://img.alicdn.com/imgextra/i3/O1CN01jd1KNR25X5FvzUhUE_!!6000000007535-0-tps-132-132.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 30
                    },
                    {
                        "code": "<3d cartoon>",
                        "name": "3D卡通",
                        "pic": "https://img.alicdn.com/imgextra/i2/O1CN01OJhm7X1GEGZq3ioj8_!!6000000000590-0-tps-132-132.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 35
                    },
                    {
                        "code": "<cyberpunk>",
                        "name": "赛博朋克",
                        "pic": "https://img.alicdn.com/imgextra/i4/O1CN01xQ0TFA1cKbbq7E4RH_!!6000000003582-0-tps-132-132.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 40
                    },
                    {
                        "code": "<pixel art>",
                        "name": "像素画",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01M81ky21UAVxL0w59W_!!6000000002477-0-tps-132-132.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 45
                    },
                    {
                        "code": "<Ukiyo-e>",
                        "name": "浮世绘",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01JBVnqh1zwNQz3GYxg_!!6000000006778-0-tps-132-132.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 50
                    },
                    {
                        "code": "<pop art>",
                        "name": "波普艺术",
                        "pic": "https://img.alicdn.com/imgextra/i1/O1CN01eQwZyG1n7Hrai88Bw_!!6000000005042-0-tps-132-132.jpg",
                        "styleType": "text_to_image",
                        "categoryId": 700,
                        "orderNumber": 55
                    }
                ]
            }
        ]
  ''';
    List<dynamic> parsedList = jsonDecode(jsonString);
    return parsedList;
  }
}
